package com.spring.context.bean;

import java.util.HashMap;
import java.util.Map;

public class BeanDefinitionRegister {

    private final Map<String, BeanDefinition> DEFINITIONS = new HashMap<String, BeanDefinition>();

    public boolean containsBeanDefinition(String beanName) {
        return DEFINITIONS.containsKey(beanName);
    }

    public void registerBeanDefinition(String beanName,
            BeanDefinition beanDefinition) {
        if (DEFINITIONS.containsKey(beanName)) {
            throw new RuntimeException();
        }
        DEFINITIONS.put(beanName, beanDefinition);
    }

    public BeanDefinition getBeanDefinition(String beanName) {
        return DEFINITIONS.get(beanName);
    }
}
